﻿using System;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using O1;
using O1.Kernel.Storage.Transactions;

namespace Tests.O1
{
    [TestClass]
    public class CLRProofs
    {
        [TestMethod, TestCategory("Unit Test")]
        public void CommittedValueAscendsAsExpected()
        {
            var x = (10L).AsCommitted();
            var y = (11L).AsCommitted();
            y.Should().BeGreaterThan(x);
        }

        [TestMethod, TestCategory("Unit Test")]
        public void MaximumCommittedValueIsNegativeOne()
        {
            long.MaxValue.AsCommitted().Should().Be(-1);
        }

        [TestMethod, TestCategory("Unit Test")]
        public void MinCommittedValueIsLongMinValue()
        {
            (0L).AsCommitted().Should().Be(long.MinValue);
        }

        [TestMethod, TestCategory("Unit Test")]
        public void TicksForSnowflakEpochStart()
        {
            var epoch = new DateTime(2014, 9, 14, 0, 0, 0, DateTimeKind.Utc).Ticks;
            epoch.Should().BeGreaterThan(0);
        }

        [TestMethod, TestCategory("Unit Test")]
        public void DateTimeOffsetIs12Btes()
        {
            unsafe
            {
                sizeof(DateTimeOffset).Should().Be(16);
            }
        }
    }
}
